/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.eventos.be;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author oscar
 */
@Entity
@Table(name = "eca_tipo_ingreso")
@NamedQueries({@NamedQuery(name = "TipoIngresoEventos.findAll", query = "SELECT t FROM TipoIngresoEventos t"), @NamedQuery(name = "TipoIngresoEventos.findByTpiCodigo", query = "SELECT t FROM TipoIngresoEventos t WHERE t.tpiCodigo = :tpiCodigo"), @NamedQuery(name = "TipoIngresoEventos.findByTpiNombre", query = "SELECT t FROM TipoIngresoEventos t WHERE t.tpiNombre = :tpiNombre")})
public class TipoIngresoEventos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "tpi_codigo")
    private Integer tpiCodigo;
    @Column(name = "tpi_nombre")
    private String tpiNombre;
    @OneToMany(mappedBy = "tpiCodigo", fetch = FetchType.LAZY)
    private List<DetalleIngresosEventos> detalleIngresosEventosList;
    @Transient
    private int numCuotas;

    public TipoIngresoEventos() {
    }

    public TipoIngresoEventos(Integer tpiCodigo) {
        this.tpiCodigo = tpiCodigo;
    }

    public int getNumCuotas() {
        return numCuotas;
    }

    public void setNumCuotas(int numCuotas) {
        this.numCuotas = numCuotas;
    }

    public Integer getTpiCodigo() {
        return tpiCodigo;
    }

    public void setTpiCodigo(Integer tpiCodigo) {
        this.tpiCodigo = tpiCodigo;
    }

    public String getTpiNombre() {
        return tpiNombre;
    }

    public void setTpiNombre(String tpiNombre) {
        this.tpiNombre = tpiNombre;
    }

    public List<DetalleIngresosEventos> getDetalleIngresosEventosList() {
        return detalleIngresosEventosList;
    }

    public void setDetalleIngresosEventosList(List<DetalleIngresosEventos> detalleIngresosEventosList) {
        this.detalleIngresosEventosList = detalleIngresosEventosList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tpiCodigo != null ? tpiCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoIngresoEventos)) {
            return false;
        }
        TipoIngresoEventos other = (TipoIngresoEventos) object;
        if ((this.tpiCodigo == null && other.tpiCodigo != null) || (this.tpiCodigo != null && !this.tpiCodigo.equals(other.tpiCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.eventos.be.TipoIngresoEventos[tpiCodigo=" + tpiCodigo + "]";
    }

}
